package main

import "fmt"

type Node interface {
	SetState(state string)
	GetState() string
}

type TextNode struct {
	state string
}

func (t *TextNode) SetState(state string) {
	t.state = state
}
func (t *TextNode) GetState() string {
	return t.state
}

func (t *TextNode) Save() *MementoText {
	return &MementoText{state: t.state}
}

type Memento interface {
}
type MementoText struct {
	state string
}
type Manage struct {
	states []*MementoText
}

// Save 保存备忘录
func (m *Manage) Save(t MementoText) {
	m.states = append(m.states, &t)
}
func main() {
	text := &TextNode{}
	text.SetState("1")
	text.SetState("2")
	text.SetState("3")
	fmt.Println(text.GetState())
}
